SwiftUI を内包する UITabBarItem.title が画面遷移で変わってしまう

swift - UITabBar containing SwiftUI View - Stack Overflow

UITabBarController が保持している UINavigationController を以下の class に置き換えたら修正された。

// Workaround: SwiftUI.NavigationLink による遷移で tabBarItem.title が無くなるバグの対応
// see: https://stackoverflow.com/a/71929880
final class TabBarItemStoringNavigation: UINavigationController {
    private var storedTabBarItem: UITabBarItem?
    override var tabBarItem: UITabBarItem! {
        get { storedTabBarItem ?? super.tabBarItem }
        set { storedTabBarItem = newValue }
    }
}

tabBarItem をセットすれば storedTabBarItem に自動でセットされるので、特に外から storedTabBarItem に明示的にセットしたり、 init で渡すといったことは不要だった。

SwiftUI UIKit